from django.db import models
from login.models import User
class Resume(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='resumes')
    name = models.CharField(max_length=100)
    sex = models.CharField(max_length=10)
    age = models.IntegerField()
    birth = models.DateField()
    origin = models.CharField(max_length=100)
    phone = models.CharField(max_length=15)
    email = models.EmailField()
    imgurl = models.CharField(max_length=100, blank=True, null=True)
    excess1 = models.CharField(max_length=100, blank=True, null=True)
    excess2 = models.CharField(max_length=100, blank=True, null=True)
    excess3 = models.CharField(max_length=100, blank=True, null=True)
    class Meta:
        db_table = 'resume'
    def __str__(self):
        return self.name

class Educated(models.Model):
    resume = models.ForeignKey(Resume, on_delete=models.CASCADE, related_name='educations')
    school = models.CharField(max_length=100)
    major = models.CharField(max_length=100)
    enrollmentTime = models.DateField()
    graduationTime = models.DateField()
    level = models.IntegerField(choices=((1, '高中及以下'), (2, '大专'), (3, '本科'), (4, '研究生'), (5, '博士')))
    isZhong = models.BooleanField(default=True)
    excess1 = models.CharField(max_length=100, blank=True, null=True,default='')
    excess2 = models.CharField(max_length=100, blank=True, null=True,default='')
    excess3 = models.CharField(max_length=100, blank=True, null=True,default='')
    class Meta:
        db_table = 'educated'
    def __str__(self):
        return self.school